<include file="public/layout" />

<script src="__ROOT__/public/static/js/layer/laydate/laydate.js"></script>
<script type="text/javascript">

    window.UEDITOR_Admin_URL = "__ROOT__/public/plugins/Ueditor/";

    var URL_upload = "{$URL_upload}";

    var URL_fileUp = "{$URL_fileUp}";

    var URL_scrawlUp = "{$URL_scrawlUp}";

    var URL_getRemoteImage = "{$URL_getRemoteImage}";

    var URL_imageManager = "{$URL_imageManager}";

    var URL_imageUp = "{$URL_imageUp}";

    var URL_getMovie = "{$URL_getMovie}";

    var URL_home = "{$URL_home}";

</script>

<load href="__ROOT__/public/plugins/Ueditor/ueditor.config.js"/>

<load href="__ROOT__/public/plugins/Ueditor/ueditor.all.js"/>
<body style="background-color: #FFF; overflow: auto;">

<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>

<div id="append_parent"></div>

<div id="ajaxwaitid"></div>

<div class="page">

    <div class="fixed-bar">

        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>

            <div class="subject">

                <h3>大转盘活动管理 - 编辑大转盘活动</h3>

                <h5>网站系统大转盘活动管理</h5>

            </div>

        </div>

    </div>

    <form class="form-horizontal" id="handleposition" method="post">

        <input type="hidden" name="id" value="{$draw.id}"/>

        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>供应商</label>
                </dt>
                <dd class="opt">
                    <div class="sDiv2">
                        <if condition="$suppliers_id">
                            <select name="suppliers" class="small form-control">
                                <option value="{$suppliers_id.suppliers_id}">{$suppliers_id.suppliers_name}</option>
                            </select>
                            <else/>
                            <select name="suppliers" class="small form-control">
                                <option value="0">请选择供应商</option>
                                <volist name="suppliers" id="vo">
                                    <option <if condition="$vo['suppliers_id'] eq $draw['suppliers_id']">selected</if> value="{$vo.suppliers_id}">{$vo.suppliers_name}</option>
                                </volist>
                            </select>
                        </if>
                    </div>
                </dd>
            </dl>



            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>大转盘活动名称</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="title" name="title" value="{$draw.title}" class="input-txt">

                    <p class="notic">请填写大转盘活动名称</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>每个人机会数</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="int_count" name="int_count"  onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" value="{$draw.intcount}" class="input-txt">

                    <p class="notic">每个人有几次机会</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>奖品设置</label>

                </dt>

                <dd class="opt">
                <div class="prize">
                <if condition="count($draw['prize_level']) gt 0">
                    <volist name="draw['prize_level']" id="vo">
                        <p data="{$i}"><span>奖项{$i}：</span><input type="hidden" id="prize_level" name="prize_level[]" value="1" class="input-num"><input type="text" id="prize_level" name="prize_level_name[]" value="{$draw['prize_level_name'][$i-1]}" class="input-num" placeholder=""><input type="text" id="prize_name" name="prize_name[]" value="{$draw['prize_name'][$i-1]}" class="input-txt" placeholder="请填写奖品名称"><input type="text" id="prize_num" name="prize_num[]" value="{$draw['prize_num'][$i-1]}" class="input-num" placeholder="请填写奖品数量"><input type="text" id="prob" name="prob[]" value="{$draw['prob'][$i-1]}" class="input-num" placeholder="请填写中奖概率"></p>
                    </volist>
                <else/>
                    <p data="1"><span>奖项1：</span><input type="hidden" id="prize_level" name="prize_level[]" value="1" class="input-num"><input type="text" id="prize_level" name="prize_level_name[]" value="" class="input-num" placeholder="一等奖"><input type="text" id="prize_name" name="prize_name[]" value="" class="input-txt" placeholder="请填写奖品名称"><input type="text" id="prize_num" name="prize_num[]" value="" class="input-num" placeholder="请填写奖品数量"><input type="text" id="prob" name="prob[]" value="" class="input-num" placeholder="请填写中奖概率"><span class="btn"><i class="fa fa-plus"></i>增加一项</span></p>
                </if>
                </div>

                    <p class="notic">设置奖品数量以及中奖概率，如果50，表示50%概率</p>
                    <style>.input-num,.input-txt{margin-left:5px;margin-bottom: 5px}
                    .btn{margin-left:10px;border:1px solid #ec5151;color:#ec5151;border-radius: 5px;padding: 2px 4px;cursor: pointer;}
                    .btn:hover{background: #eee}
                    </style>

                </dd>

            </dl>

            <dl class="row">
                <dt class="tit"><em>*</em>活动图片</dt>
                <dd class="opt">
                    <div class="input-file-show" id="divComUploadContainer">
            <span class="show">
                <a class="nyroModal" rel="gal" href="{$draw.headpic}">
                    <i class="fa fa-picture-o" onMouseOver="layer.tips('<img src={$draw.headpic}>',this ,{tips: [1, '#fff']});" onMouseOut="layer.closeAll();"></i>
                </a>
            </span>
            <span class="type-file-box">
            <input type="text" id="imagetext" name="headpic" value="{$draw.headpic}" class="type-file-text">
            <input type="button" class="type-file-button" onClick="GetUploadify(1,'imagetext','goods','')" value="上传图片"  hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效"/>
            </span>
                    </div>
                    <div id="thumbnails" class="ncap-thumb-list">
                        <h5><i class="fa fa-exclamation-circle"></i> 请上传图片格式文件。</h5>
                        <ul>
                        </ul>
                    </div>
                </dd>
            </dl>
            <dl class="row">

                <dt class="tit">

                    <label>活动说明</label>

                </dt>

                <dd class="opt">

                    <textarea class="span12 ckeditor" placeholder="请输入活动说明" id="content" name="content" rows="6">{$draw.content}</textarea>

                    <p class="notic">活动说明</p>

                </dd>

            </dl>

            <dl class="row timed">

                <dt class="tit">

                    <label><em>*</em>活动开始日期</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="start_time" name="start_time" value="{$draw.start_time|date='Y-m-d H:i:s',###}" class="input-txt">

                    <p class="notic">活动开始日期</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>活动结束日期</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="end_time" name="end_time" value="{$draw.end_time|date='Y-m-d H:i:s',###}" class="input-txt">

                    <p class="notic">活动结束日期</p>

                </dd>

            </dl>

            <div class="bot"><a onclick="$('#handleposition').submit();" class="ncap-btn-big ncap-btn-green">确认提交</a></div>

        </div>

    </form>

</div>

<script type="text/javascript">

    $('.btn').click(function(){
        var strr={'1':'一等奖','2':'二等奖','3':'三等奖','4':'四等奖','5':'五等奖','6':'六等奖','7':'七等奖','8':'八等奖'}
        var data=parseInt($('.prize').children('p:last-child').attr('data'))
        data++;
        $('.prize').append('<p data="'+data+'"><span>奖项'+data+'：</span><input type="hidden" id="prize_level" name="prize_level[]" value="'+data+'" class="input-num"><input type="text" id="prize_level_name" name="prize_level_name[]" value="" class="input-num" placeholder="'+strr[data]+'"><input type="text" id="prize_name" name="prize_name[]" value="" class="input-txt" placeholder="请填写奖品名称"><input type="text" id="prize_num" name="prize_num[]" value="" class="input-num" placeholder="请填写奖品数量"><input type="text" id="prob" name="prob[]" value="" class="input-num" placeholder="请填写中奖概率"></p>');
       
    })



    $(document).ready(function(){

        $('input[type="radio"]:checked').trigger('click');

        $('#start_time').layDate();

        $('#end_time').layDate();
    })

    var editor;

    $(function () {

        //具体参数配置在  editor_config.js 中

        var options = {

            zIndex: 999,

            initialFrameWidth: "100%", //初化宽度

            initialFrameHeight: 350, //初化高度

            focus: false, //初始化时，是否让编辑器获得焦点true或false

            maximumWords: 99999, removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',

            pasteplain: true, autoHeightEnabled: true,

            autotypeset: {

                mergeEmptyline: true,        //合并空行

                removeClass: true,           //去掉冗余的class

                removeEmptyline: false,      //去掉空行

                textAlign: "left",           //段落的排版方式，可以是 left,right,center,justify 去掉这个属性表示不执行排版

                imageBlockLine: 'center',    //图片的浮动方式，独占一行剧中,左右浮动，默认: center,left,right,none 去掉这个属性表示不执行排版

                pasteFilter: false,          //根据规则过滤没事粘贴进来的内容

                clearFontSize: false,        //去掉所有的内嵌字号，使用编辑器默认的字号

                clearFontFamily: false,      //去掉所有的内嵌字体，使用编辑器默认的字体

                removeEmptyNode: false,      //去掉空节点

                removeTagNames: {"font": 1},

                indent: false,               // 行首缩进

                indentValue: '0em'           //行首缩进的大小

            },

            toolbars: [

                ['fullscreen', 'source', '|', 'undo', 'redo','|', 'bold', 'italic', 'underline', 'fontborder',

                    'strikethrough', 'superscript', 'subscript','removeformat', 'formatmatch', 'autotypeset',

                    'blockquote', 'pasteplain', '|', 'forecolor','backcolor', 'insertorderedlist',

                    'insertunorderedlist', 'selectall', 'cleardoc', '|','rowspacingtop', 'rowspacingbottom', 'lineheight', '|',

                    'customstyle', 'paragraph', 'fontfamily', 'fontsize','|', 'directionalityltr', 'directionalityrtl',

                    'indent', '|', 'justifyleft', 'justifycenter','justifyright', 'justifyjustify', '|', 'touppercase',

                    'tolowercase', '|', 'link', 'unlink', 'anchor', '|','imagenone', 'imageleft', 'imageright', 'imagecenter',

                    '|', 'insertimage', 'emotion', 'insertvideo','attachment', 'map', 'gmap', 'insertframe',

                    'insertcode', 'webapp', 'pagebreak', 'template','background', '|', 'horizontal', 'date', 'time',

                    'spechars', 'wordimage', '|','inserttable', 'deletetable','insertparagraphbeforetable', 'insertrow', 'deleterow',

                    'insertcol', 'deletecol', 'mergecells', 'mergeright','mergedown', 'splittocells', 'splittorows',

                    'splittocols', '|', 'print', 'preview', 'searchreplace']

            ]

        };

        editor = new UE.ui.Editor(options);

        editor.render("content");



        $('#start_time').layDate();

        $('#end_time').layDate();

    });



</script>

</body>

</html>